package com.ft.model.enums;

import lombok.Getter;

/**
 * @author: zhangjianghua
 * @Date: 2018-10-09 16:56
 */
@Getter
public enum OrderStatusChangeEventEnum {
    /**
     * 支付，发货，确认收货
      */
    PAYED(1,"支付"),
    DELIVERY(2,"发货"),
    RECEIVED(3,"确认收货");

    private final Integer id;
    private String desc;

    OrderStatusChangeEventEnum(Integer id, String desc){
        this.id = id;
        this.desc = desc;
    }
    public static OrderStatusChangeEventEnum fromById(Integer id) {
        for (OrderStatusChangeEventEnum mode: values()){
            if(mode.getId().equals(id)){
                return mode;

            }
        }
        throw new UnsupportedOperationException(
                "Enum conversion failed: the id " + id + " is not supported!"
        );
    }
}
